<?PHP
$PageID=3;
$nohead=1;
$nojs=1;
//不需要头部

include_once('../../../core/common.php');
			
			if(isset($_GET['page'])){
			$page = $_GET['page'];
			$limit = $_GET['limit'];
			$page=($page-1)*$limit;
			
			$sql = "SELECT COUNT(PageID) FROM pages ;";
			$ret = run_sql($sql);
			$datatemp0=mysqli_fetch_all($ret,MYSQLI_ASSOC);
			
			
			$sql = "
			select * from pages where PageID >= (select PageID from pages order by PageID limit $page, 1) limit $limit;";
			$ret = run_sql($sql);
			$datatemp=mysqli_fetch_all($ret,MYSQLI_ASSOC);
			//读取一条结果到数组
			$data['code'] = 0 ;
			$data['msg'] = "" ;
			$data['count'] = $datatemp0[0]['COUNT(PageID)'] ;
			$data['data'] = $datatemp ;
			
			echo json_encode($data);
			
			}else{
				$data['code'] = 1 ;
				$data['msg'] = "参数出错" ;
				echo json_encode($data);
			}
?>